Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ableton-link): add ableton link support to orca #247

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mcartagenah
Copy link

I think Orca should have Ableton Link support, so I used this package https://github.com/Onni97/abletonlink-node-addon to achieve this, I think it's working ok, but needs more testing.

So far you can play/pause and change the tempo, I haven't noticed any drifts in tempo, maybe a little when you change it very quickly.

I'm open to suggestions on how to implement this, or if there's another functionality of ableton link needed.

Hope everyone likes it :D

@mcartagenah
Copy link
Author

I forgot, to enable/disable Link you can send the command link 😅

@neauoire
Copy link
Member

neauoire commented Oct 7, 2020

I will not merge this in master, but I think it's a good feature, would you be game to maintain a fork up to date for this instead?

@mcartagenah
Copy link
Author

I have no problem in maintaining a fork with this feature.
What you think it needs to be in master?

@neauoire
Copy link
Member

neauoire commented Oct 7, 2020

I'd love to add the link to the fork in the readme for others to try if they use ableton.

I keep the master branch free of libraries, and specific code to keep the codebase simple, generic and hackable even for people who are not too familiar with javascript. It's a bit of a playground, between choosing to have fast code and readable code, I'll always go for readable code for master, as to keep the bar pretty low for anyone who need to customize it.

The only PRs that can go in master is small changes to help with readability and stability and bug fixes to the spec.

@mcartagenah
Copy link
Author

I understand :)

I'll keep the fork up to date and would love if you add a link to it in your readme.

@unthingable
Copy link
Contributor

unthingable commented Oct 7, 2020

One unfortunate problem with disparate forks is not having a single place to discuss PRs.

@mcartagenah very nice! If this existed earlier I probably would not have bothered with MIDI clock :)

@mcartagenah
Copy link
Author

One unfortunate problem with disparate forks is not having a single place to discuss PRs.

@mcartagenah very nice! If this existed earlier I probably would not have bothered with MIDI clock :)

I think your work was needed too, for example, syncing Orca to external analog gear :)

@mcartagenah
Copy link
Author

I fixed some bugs and took in consideration all your feedback.

Hope it's working ok!

@unthingable
Copy link
Contributor

unthingable commented Oct 8, 2020

@mcartagenah thanks for taking a swing at it!

Finally took it for a test drive, good news is Link links and reacts to start/stop/tempo, bad news is it's not very usable yet, at least on my end:

  • getting massive beat drift while playing
  • random offsets when starting and stopping link
  • changing tempo throws Orca out of sync (as predicted, via setFrame(0))

The trick, I think, is getting Orca to sync to a beat initially and then keeping it in sync (Orca's own clock is pretty much guaranteed to drift over time). Seeing that the library you picked does not offer callbacks, you will likely have to repeatedly calculate where Orca's beats should land and adjust internal scheduling.

It's It would have been much easier to make it Link's job to advance frames on its own schedule and not use the internal clock, that's how MIDI clock works already. Maybe have a look at https://github.com/2bbb/node-abletonlink, this one seems to have callbacks.

@mcartagenah
Copy link
Author

Sad to hear it doesn't work for you, I'll keep tweaking it to find how to maintain a good sync.
I tried the package you mentioned, but some callbacks weren't working as said in the documentation.

@unthingable
Copy link
Contributor

some callbacks weren't working as said in the documentation

Right, upon a closer look that package provides less functionality than abletonlink-addon. What's more, neither the underlying library nor the Napi wrapper node-abletonlink is using seem to support beat-synced scheduling, so avoiding Orca's internal clock is not possible.

Then the right thing to do is to periodically (on every frame?) get beat/phase/quantum information from Link and adjust Orca's clock scheduler accordingly.

@mcartagenah
Copy link
Author

mcartagenah commented Oct 26, 2020

I made an implementation of the clock scheduler and think it's working, also added quantized launch (it's kinda working).
@unthingable hope you can test it if you have the time, the branch is called ableton_link_v2 on my fork 😄

@neauoire neauoire mentioned this pull request Jan 2, 2021
@mcartagenah mcartagenah marked this pull request as draft March 5, 2021 03:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants